package com.homework.ch08;

import java.util.*;

public class Test5 {
    public static void main(String[] args) {
        Collection<Integer> set1=new HashSet<>();
        Random random=new Random();
        //插入10个元素
        while(set1.size()<10)
        {
            set1.add(random.nextInt(20)+1);
        }
        //System.out.println(set1);
        Iterator<Integer> it=set1.iterator();
        while(it.hasNext())
        {
            Integer v=it.next();
            System.out.print(v+" ");
        }
    }
}
